#ifndef _REALTIMETLAKBACK_H_
#define _REALTIMETLAKBACK_H_


#ifdef __cplusplus
extern "C"
{
#endif
#pragma pack (1)
typedef struct
{
	unsigned char 			_sync;
	unsigned short 			_len;  		    //all(header + data)
	unsigned char 			_version;
	unsigned char   		_status;  		//Bit7	 Bit6	Bit5	Bit4	Bit3		Bit2		Bit1		Bit0
	unsigned char   		_plattype;		//0		0		0		0		ACTIVE_PLAY	ACTIVE_PULL	ACTIVE_PUSH	ACTIVE_ALIVE
	unsigned long long   	_devid;	
	unsigned char 			_devtype;
}C_TalkBackHeader;
typedef struct 
{
	unsigned short _len;		//C_TalkBackDataHeader + data
	unsigned char _cmd;
}C_TalkBackDataHeader;

typedef struct DAT{
	int  size;
	unsigned char *dat;
}TalkBackMsg;

#pragma pack()

#define TALKBACK_PRI	(10)

#ifdef TESTNET
#define TALKBACKSER_IP		"106.75.130.105"  //正式版本
#define TALKBACKSER_IP_TEST "106.75.130.107"  //测试版本
#else
#define TALKBACKSER_IP      "106.75.130.105"  //正式版本
#endif

#ifndef IPC_SHAKE4G
#define TALKBACKSER_PORT	(4759)
#else
#define TALKBACKSER_PORT	(4756)
#endif
//snd
int TalkBackHeartbeatSend();
int TalkBackProtoMakePacket(int cmd);
int Fun_TalkBackHeartBeat(int cmd);

//rcv
///    ===============================================
///               |
///        TalkBackRcvData
///               |------------+------------------+
///               |            |                  |  
///               |            |				  |
///  TalkBackRcvDataProtoAnalysis                 |
///               |            |                  |
///               |   Fun_TalkBackAudioRcv        |
///               |            |                  |
///               |------------+------------------+
///    ===============================================
int TalkBackRcvData();
int TalkBackRcvDataProtoAnalysis();
int Fun_TalkBackAudioRcv(TalkBackMsg Data);
	
//init
//int TalckBackInitPro(C_TalkBackPro *Args);
int TalkBack_SetDevMac(char *Mac);
int TalkBackStart(void);
int TalkBackStop(void);


int G711u_Decode(void* pInData,int length,void* pOutData);
int RealTimeAudioPlayProGress(unsigned char* buf, int size);
#ifdef __cplusplus
}
#endif
#endif
